<?php


namespace app\admin\model;


class Click extends BaseModel
{
    public function getClickNumAttr($value)
    {
        $arr = json_decode($value, true);
        $str = $this->str($arr);
        return $str;
    }

    public function getOpenNumAttr($value)
    {
        $arr = json_decode($value, true);
        $str = $this->str($arr);
        return $str;
    }

    private function str($arr)
    {
        $str = "";
        foreach ($arr as $value){
//            $data ="{产品：$title, 数量：$num}，";
            $data ="{{$value['title']} = {$value['num']}}，";
            $str .= $data;
        }
        return $str;
    }
}